<?php
/**
 * @author Inhere
 * @version v1.0
 * Use : Router管理服务
 * Date : 2015-1-10
 * RouteServiceProvider.php
 */
namespace ulue\base\providers;

use ulue\core\ioc\Container,
    ulue\core\router\Router;
use ulue\core\ioc\InterfaceServiceProvider;

class RouteServiceProvider implements InterfaceServiceProvider
{
    /**
     * 注册一个服务提供者， RouteServiceProvider
     * @param  Container $container 传入容器
     * @throws \DInvalidArgumentException
     * @return mixed|void
     */
    public function register(Container $container)
    {

        $closure = function()
        {
            $options = \Ulue::readRouteConfiguration();

            return new Router($options);
        };

        $container->share('router',$closure)->alias('app.router')->alias('application.router');
    }
}